package base.exa07_methodOverride;

public class SuperStudy {

    public static void main(String[] args) {
        Student1 student1 = new Student1();
        System.out.println(student1.add(2,3));
    }

}

/**
 * 类Person1
 */
class Person1 {

    int add(int x,int y){
        System.out.println(x+y);
        return x+y;
    }

    int add(int x){
        System.out.println("我会加法");
        return x+1;
    }

    int add(int x,int y,int z){
        return x+y+z;
    }
}

/**
 * Person1的子类Student1
 */
class Student1 extends Person1{
    /**
     * 子类Student重写父类Person的方法：
     * int add(int x,int y)
     * @param x
     * @param y
     * @return
     */
    int add(int x,int y){
        super.add(1,2);
        return x+y+y;
    }
}
